#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QtSerialPort/QSerialPort>
#include <QtSerialPort/QSerialPortInfo>
#include <QDebug>
#include <QTimer>
#include <QPixmap>
#include <QTextStream>
#include <QMessageBox>
#include <QPainter>
#include "qcustomplot.h"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    QPixmap pixmap_to_round(QPixmap &src,double radius);
    void windows_init();
    void serialport_init();
    void read_serialport();     //读串口数据
    void find_serialport();     //查找串口
    void insert_table(QString date, QString t);
    QPixmap fitpixmap;

private slots:
    void onMouseMove(QMouseEvent* event);

    void customsplot_init();

    void on_start_clicked();

    void on_pause_clicked();

    void on_open_port_clicked();

    void on_close_port_clicked();

    void on_decrease_temp_clicked();

    void on_increase_temp_clicked();

    void on_clear_form_clicked();

    void on_save_form_clicked();

    void checkbox_change();

private:
    Ui::MainWindow *ui;
    float temperature; //温度
    float set_temperature; //设定温度
    QTimer dataTimer;           //时间
    QSerialPort *serialport;    //串口类

    //定时器
    QTimer *_pTimerUpdate;

    QCPItemText *textItem;
};
#endif // MAINWINDOW_H
